package com.ruoyi.informfrontend.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.informfrontend.mapper.CollectionMapper;
import com.ruoyi.informfrontend.domain.Collection;
import com.ruoyi.informfrontend.service.ICollectionService;

/**
 * 收藏Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-06-13
 */
@Service
public class CollectionServiceImpl implements ICollectionService 
{
    @Autowired
    private CollectionMapper collectionMapper;

    /**
     * 查询收藏
     * 
     * @param id 收藏主键
     * @return 收藏
     */
    @Override
    public Collection selectCollectionById(Long id)
    {
        return collectionMapper.selectCollectionById(id);
    }

    /**
     * 查询收藏列表
     * 
     * @param collection 收藏
     * @return 收藏
     */
    @Override
    public List<Collection> selectCollectionList(Collection collection)
    {
        return collectionMapper.selectCollectionList(collection);
    }

    /**
     * 新增收藏
     * 
     * @param collection 收藏
     * @return 结果
     */
    @Override
    public int insertCollection(Collection collection)
    {
        collection.setCreateTime(DateUtils.getNowDate());
        return collectionMapper.insertCollection(collection);
    }

    /**
     * 修改收藏
     * 
     * @param collection 收藏
     * @return 结果
     */
    @Override
    public int updateCollection(Collection collection)
    {
        collection.setUpdateTime(DateUtils.getNowDate());
        return collectionMapper.updateCollection(collection);
    }

    /**
     * 批量删除收藏
     * 
     * @param ids 需要删除的收藏主键
     * @return 结果
     */
    @Override
    public int deleteCollectionByIds(Long[] ids)
    {
        return collectionMapper.deleteCollectionByIds(ids);
    }

    /**
     * 删除收藏信息
     * 
     * @param id 收藏主键
     * @return 结果
     */
    @Override
    public int deleteCollectionById(Long id)
    {
        return collectionMapper.deleteCollectionById(id);
    }
}
